#pragma once

#include <QComboBox>
#include <QDoubleSpinBox>
#include <QListWidget>
#include <QStackedWidget>
#include <QPushButton>
#include "particledefine.h"

namespace ParticleEditor
{
	class PointPlacer:public QWidget
	{
		Q_OBJECT
	public:
		PointPlacer(QWidget* parent = NULL);
		PointPlacer(int index,QWidget* parent = NULL);
		~PointPlacer();
		void initPointPlacer(ParticleSystemLayer psl);
		void initPointPlacer(ParticleSystemLayer psl,int index);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl);
	private:
		void init();
		QDoubleSpinBox*								_pointPlacerXSpinBox;
		QDoubleSpinBox*								_pointPlacerYSpinBox;
		QDoubleSpinBox*								_pointPlacerZSpinBox;
		ParticleSystemLayer							_particleSystemLayer;
		int											_index;
	private slots:
		void slotsPointPlacerXSpinBoxValueChanged(double);
		void slotsPointPlacerYSpinBoxValueChanged(double);
		void slotsPointPlacerZSpinBoxValueChanged(double);
	};

	class SectorPlacer:public QWidget
	{
		Q_OBJECT
	public:
		SectorPlacer(QWidget* parent = NULL);
		~SectorPlacer();
		void initSectorPlacer(ParticleSystemLayer psl);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl);
	private:
		QDoubleSpinBox*								_sectorPlacerXSpinBox;
		QDoubleSpinBox*								_sectorPlacerYSpinBox;
		QDoubleSpinBox*								_sectorPlacerZSpinBox;
		QDoubleSpinBox*								_sectorPlacerMinRadiusSpinBox;
		QDoubleSpinBox*								_sectorPlacerMaxRadiusSpinBox;
		QDoubleSpinBox*								_sectorPlacerMinPhiSpinBox;
		QDoubleSpinBox*								_sectorPlacerMaxPhiSpinBox;
		ParticleSystemLayer							_particleSystemLayer;
	private slots:
		void slotsSectorPlacerXSpinBoxValueChanged(double);
		void slotsSectorPlacerYSpinBoxValueChanged(double);
		void slotsSectorPlacerZSpinBoxValueChanged(double);
		void slotsPlacerMinRadiusSpinBoxValueChanged(double);
		void slotsPlacerMaxRadiusSpinBoxValueChanged(double);
		void slotsPlacerMinPhiSpinBoxValueChanged(double);
		void slotsPlacerMaxPhiSpinBoxValueChanged(double);
	};

	class SegmentPlacer:public QWidget
	{
		Q_OBJECT
	public:
		SegmentPlacer(QWidget* parent = NULL);
		~SegmentPlacer();
		void initSegmentPlacer(ParticleSystemLayer psl);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl);
	private:
		void init();
		QDoubleSpinBox*								_segmentPlacerAXSpinBox;
		QDoubleSpinBox*								_segmentPlacerAYSpinBox;
		QDoubleSpinBox*								_segmentPlacerAZSpinBox;
		QDoubleSpinBox*								_segmentPlacerBXSpinBox;
		QDoubleSpinBox*								_segmentPlacerBYSpinBox;
		QDoubleSpinBox*								_segmentPlacerBZSpinBox;
		ParticleSystemLayer							_particleSystemLayer;
	private slots:
		void slotsSegmentPlacerAXSpinBoxValueChanged(double);
		void slotsSegmentPlacerAYSpinBoxValueChanged(double);
		void slotsSegmentPlacerAZSpinBoxValueChanged(double);
		void slotsSegmentPlacerBXSpinBoxValueChanged(double);
		void slotsSegmentPlacerBYSpinBoxValueChanged(double);
		void slotsSegmentPlacerBZSpinBoxValueChanged(double);
	};

	class MultiSegmentPlacer:public QWidget
	{
		Q_OBJECT
	public:
		MultiSegmentPlacer(QWidget* parent = NULL);
		~MultiSegmentPlacer();
		void initMultiSegmentPlacer(ParticleSystemLayer psl);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl);
	private:
		QListWidget*								_listWidget;
		ParticleSystemLayer							_particleSystemLayer;
		QPushButton*								_addButton;
		QPushButton*								_deleteButton;
		PointPlacer*								_pointPlacer;
	private slots:
		void refreshListWidget();
		void slotsSelectListViewChanged(int index);
		void slotsAddButtonPushed();
		void slotsDeleteButtonPushed();
	};

	class PlacerSettingWidget:public QWidget
	{
		Q_OBJECT
	public:
		PlacerSettingWidget(QWidget* parent = NULL);
		~PlacerSettingWidget();
		void initPlacerSettingWidget(ParticleSystemLayer psl);
		void copyLayer(ParticleSystemLayer psl,ParticleSystemLayer newpsl);
	private:
		QStackedWidget*							_stackedWidget;
		QComboBox*								_placerTypeBox;
		ParticleSystemLayer						_particleSystemLayer;
		PointPlacer*							_pointPlacer;
		SectorPlacer*							_sectorPlacer;
		SegmentPlacer*							_segmentPlacer;
		MultiSegmentPlacer*						_multiSegmentPlacer;
		QWidget*								_defaultWidget;
	private slots:
		void slotsPlacerTypeBox(const QString&);
	};
}